package com.sim.serialport.library.seria.di

import android.content.Context
import android.net.Uri
import com.google.gson.Gson
import com.google.gson.GsonBuilder
import com.infinit.selfhelp.common.net.converter.StringConverter
import com.infinit.selfhelp.common.net.converter.UriTypeAdapter
import com.sim.serialport.library.seria.DataStore
import com.sim.serialport.library.seria.DataStoreImpl
import com.sim.serialport.library.seria.SerialManager
import dagger.Binds
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton


@Module
@InstallIn(SingletonComponent::class)
object SerialPortModule {

    @Provides
    @Singleton
    fun provideSerialPortManager() = SerialManager()

    @Provides
    @Singleton
    fun gsonProvide(): Gson {
        return GsonBuilder().registerTypeAdapter(String::class.java, StringConverter()).registerTypeAdapter(Uri::class.java, UriTypeAdapter()).serializeNulls().create()
    }
}
//@Module
//@InstallIn(SingletonComponent::class)
//interface DataModule{
//
//}